package com.jiangyg.devtools.ui.table.cell;

import com.intellij.ui.JBColor;
import com.intellij.ui.components.JBLabel;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;

import javax.swing.*;
import javax.swing.table.TableCellRenderer;
import java.awt.*;

/**
 * 类描述：包选择器单元格渲染
 *
 * @author jiangyg
 * @version 1.0
 * @date 2023年08月29日
 */
public class PackageChooserCellRenderer implements TableCellRenderer {

    @Override
    public Component getTableCellRendererComponent(JTable table,
                                                   Object value,
                                                   boolean isSelected,
                                                   boolean hasFocus,
                                                   int rowIndex, int columnIndex) {
        final String string = String.valueOf(value);

        final JBLabel label = new JBLabel(string);
        label.setToolTipText(string);
        label.setForeground(JBColor.getHSBColor(288, 58, 90));
        UIUtil.addInsets(label, JBUI.insets(0, 10));

        return label;
    }

}
